using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.AuthCodeDB
{
    public class Sys_ModelMap : EntityTypeConfiguration<Sys_Model>
    {
        public Sys_ModelMap()
        {
            // Primary Key
            this.HasKey(t => t.ModelID);

            // Properties
            this.Property(t => t.ModelID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ModelCName)
                .HasMaxLength(20);

            this.Property(t => t.ModelEName)
                .HasMaxLength(20);

            this.Property(t => t.ParentID)
                .HasMaxLength(50);

            this.Property(t => t.URL)
                .HasMaxLength(50);

            this.Property(t => t.Creator)
                .HasMaxLength(50);

            this.Property(t => t.UpdateUser)
                .HasMaxLength(50);

            this.Property(t => t.OrderNum)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Sys_Model");
            this.Property(t => t.ModelID).HasColumnName("ModelID");
            this.Property(t => t.ModelCName).HasColumnName("ModelCName");
            this.Property(t => t.ModelEName).HasColumnName("ModelEName");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.URL).HasColumnName("URL");
            this.Property(t => t.IsShow).HasColumnName("IsShow");
            this.Property(t => t.Creator).HasColumnName("Creator");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateUser).HasColumnName("UpdateUser");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OrderNum).HasColumnName("OrderNum");
        }
    }
}
